<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>诊断列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/1.1.3/weui.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        body {
            background-color: #f8f8f8;
        }
    </style>
</head>
<body>
<div class="page">
    <div class="weui-panel">
        <div class="weui-panel__bd">
            <div class="weui-media-box weui-media-box_small-appmsg">
                <div class="weui-cells">
                    <a class="weui-cell weui-cell_access" style="color: #586c94;" href="./indexAddDiagnose.html">
                        <div class="weui-cell__bd weui-cell_primary">
                            <p>添加诊断信息</p>
                        </div>
                        <span class="weui-cell__ft"></span>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <div class="weui-cells__title">诊断列表</div>
    <div id="container"></div>
</div>

</body>
<script>
    var template = 
    '<div class="weui-panel">' +
    '    <div class="weui-panel__hd">签约医生：<span id="visitDoc" style="color: #333;"></span></div>' +
    '    <div class="weui-panel__bd">' +
    '        <div class="weui-media-box weui-media-box_text">' +
    '            <p class="weui-media-box__desc" style="font-size: 15px;">诊断：<span id="result" style="color: #333;"></span></p>' +
    '            <ul class="weui-media-box__info">' +
    '               <li class="weui-media-box__info__meta" id="time">时间</li>' +
    '           </ul>' +
    '        </div>' +
    '    </div>' +
    '</div>';
    $.ajax({
        type: "GET",
        url: "http://patient-demo.huimeimt.cn:8080/diagnosisInfo/selectDiagnosisInfo",
        data: "",
        dataType: 'json',
        contentType: 'application/json',
        success: function (data) {
            for(var i = 0; i < data.data.length;i++){
                var item = data.data[i];
                var html = $(template);
                html.find('#visitDoc').html(data.visitDoc);
                html.find('#time').html(item.diagnosisDate);
                html.find('#result').html(item.diagnosis);
                $('#container').append(html);
            }
        },
    });
</script>
</html>